import com.tgl.util.FileLockUtil
import spock.lang.Specification

import java.nio.channels.FileLock

class FileLockUtilTest extends Specification{

    // 测试加锁解锁方法
    def "test lock"() {
        // given块
        given: "initial conditions"
        // 设置前置条件或数据
        when: "action is performed"
        FileLock lock = FileLockUtil.getLock(new File("file3.txt"));

        FileLockUtil.releaseLock(lock);
        then:
        noExceptionThrown()
    }

}
